<?php
require_once("admin_header.php");
require_once("../include/check_get_key.php");
$user = $_GET['user'];
if (!isset($_SESSION['administrator']) && !isset($_SESSION[$BM_ADMIN]))
    exit();
$to_active = intval($_GET['to_active']);
$sql    = "select `user_active".$to_active."` FROM `cr_user` WHERE `user_id`='$user'";
$result = mysql_query($sql);
$num    = mysql_num_rows($result);
if ($num < 1) 
{
    mysql_free_result($result);
    echo "没有这个用户!";
    require_once("../bm-footer.php");
    exit(0);
}
$row = mysql_fetch_row($result);
if ($row[0] == 'N')
    $sql = "UPDATE `cr_user` SET `user_active".$to_active."`='Y' WHERE `user_id`='$user'";
else
    $sql = "UPDATE `cr_user` SET `user_active".$to_active."`='N' WHERE `user_id`='$user'";
mysql_free_result($result);
mysql_query($sql);

?>
<script language=javascript>
	history.go(-1);
</script>
